package kz.pompei.porelinar.model;

public class Atom {
  public final AtomType type;
  public final int offset, length;
  public final int startLine, startCol;
  
  public Atom(AtomType type, int offset, int length, int startLine, int startCol) {
    this.type = type;
    this.offset = offset;
    this.length = length;
    this.startLine = startLine;
    this.startCol = startCol;
  }
  
  public String toDisplayStr(char[] chars) {
    String content = new String(chars, offset, length);
    switch (type) {
    case CONST:
      return "⁅" + content + "⁆";
      
    case NL:
      return "↲\n";
      
    case SIGN:
      return content;
      
    case SPACES:
      return content;
      
    case STRING:
      return content;
      
    case WORD:
      return "〈" + content + "〉";
      
    default:
      return content;
    }
  }
}
